#include<iostream>
#include<memory>
#include"udpserver.hpp"
#include"Dic.hpp"
int main(int argc,char *argv[])
{
    if(argc!=2)
    {
        std::cerr<<"usage fail"<<std::endl;
    }
    uint16_t port = std::stoi(argv[1]);
    //首先要有一个字典对象
    Dictionary dict;
    dict.loaddict();
    //网络服务器对象，提供网络通信功能
    std::unique_ptr<udpserver>user = std::make_unique<udpserver>(port,[&dict](const std::string &word,inetaddr &client)->std::string
{
   return dict.Translate(word,client);
});
    user->init();
    user->start();
    return 0;
}